package com.mmlc.meimei.lichengkongjian.mine;

import android.os.Parcel;
import android.os.Parcelable;
import android.view.View;
import android.widget.ListView;

import com.mmlc.inter.InterActivity;
import com.mmlc.meimei.lichengkongjian.Adapter.ActivityMuchOrderAdapter;
import com.mmlc.meimei.lichengkongjian.R;
import com.mmlc.meimei.lichengkongjian.been.AllOrderBean;
import com.mmlc.widget.TitleBarView;

import java.util.ArrayList;
import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

public class ActivityMuchOrder extends InterActivity {


    @InjectView(R.id.tb_titleBar)
    TitleBarView tbTitleBar;
    @InjectView(R.id.lv_shopList)
    ListView lvShopList;

    @Override
    protected int initContentView() {
        return R.layout.activity_waitsendshop;
    }

    @Override
    protected void initView() {
        ButterKnife.inject(this);
        processData();
    }

    ActivityMuchOrderAdapter adapter;
    ActivityMuchOrder_Transmit transmit;
    private void processData() {

        transmit = getIntent().getParcelableExtra(ActivityMuchOrder_Transmit.class.getName());

        tbTitleBar.getLeftBtn().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        tbTitleBar.setCenterName("订单列表");

        //订单列表
        adapter = new ActivityMuchOrderAdapter(lvShopList, transmit.orderList);
        lvShopList.setAdapter(adapter);
    }

    @Override
    protected void initEvent() {

    }

    public static class ActivityMuchOrder_Transmit implements Parcelable {
        public List<AllOrderBean> orderList;

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeList(this.orderList);
        }

        public ActivityMuchOrder_Transmit() {
        }

        protected ActivityMuchOrder_Transmit(Parcel in) {
            this.orderList = new ArrayList<AllOrderBean>();
            in.readList(this.orderList, AllOrderBean.class.getClassLoader());
        }

        public static final Creator<ActivityMuchOrder_Transmit> CREATOR = new Creator<ActivityMuchOrder_Transmit>() {
            @Override
            public ActivityMuchOrder_Transmit createFromParcel(Parcel source) {
                return new ActivityMuchOrder_Transmit(source);
            }

            @Override
            public ActivityMuchOrder_Transmit[] newArray(int size) {
                return new ActivityMuchOrder_Transmit[size];
            }
        };
    }
}
